package ${t_package}.service;
import ${t_package}.domain.${t_bean};
import ${t_package}.repository.${t_bean}Repository;
import ${t_package}.repository.specifications.${t_bean}Specs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

/**
* @Title: Service
* @Description: ${ftl_description}
* @author ${ftl_auth}
* @date ${ftl_create_time}
* @version V1.0
*
*/
@Service
public class ${t_bean}Service {

@Autowired
private ${t_bean}Repository  ${t_bean?uncap_first}Repository;

/**
* 新增或者保存
* @param ${t_bean?uncap_first}
* @return
*/
public ${t_bean} save(${t_bean} ${t_bean?uncap_first}) {
    return ${t_bean?uncap_first}Repository.save(${t_bean?uncap_first});
}

/**
* 删除
* @param id
*/
public void  delete(String id) {
    ${t_bean?uncap_first}Repository.delete(id);
}
/**
* 根据id查询
* @param id
* @return
*/
public ${t_bean} findById(String id) {
    return ${t_bean?uncap_first}Repository.findOne(id);
}


/**
* 分页查找
* @param ${t_bean?uncap_first}
* @param pr
* @return
*/
public Page<${t_bean}> getPageList(${t_bean} ${t_bean?uncap_first}, PageRequest pr) {
    Page<${t_bean}> totalList = ${t_bean?uncap_first}Repository.findAll(${t_bean}Specs.pageQuery${t_bean}(${t_bean?uncap_first}), pr);
    return totalList;
}

}
